# the minimum version of CMake.
cmake_minimum_required(VERSION 3.8.0)
project(MyApplication3)

set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
set(OPENSSL_LIB_PATH ${NATIVERENDER_ROOT_PATH}/../../../libs/${OHOS_ARCH})

if(DEFINED PACKAGE_FIND_FILE)
    include(${PACKAGE_FIND_FILE})
endif()

include_directories(${NATIVERENDER_ROOT_PATH}
                    ${NATIVERENDER_ROOT_PATH}/include
                    ${NATIVERENDER_ROOT_PATH}/openssl/${OHOS_ARCH}/include
                    ${NATIVERENDER_ROOT_PATH}/aliyun/include
                    )

add_compile_options(-Wno-deprecated-declarations)

add_library(cordova SHARED
    Application.cpp
    rawfile_request.cpp
    HttpUrl.cpp
    napi_init.cpp
    Base64.cpp
    CallbackContext.cpp
    cJSON.cpp
    ConfigXmlParser.cpp
    CordovaBridge.cpp
    CordovaExposedJsApi.cpp
    CordovaPreferences.cpp
    CordovaViewController.cpp
    CordovaWebViewEngine.cpp
    NativeToJsMessageQueue.cpp
    SystemCookieManager.cpp
    PluginManager.cpp
    PluginResult.cpp
    sqlc/sqlite3.c
    XMLParser.cpp
    XMLNode.cpp
    Thread.cpp
    sqlc/SQLiteConnectorDatabase.cpp
    sqlc/SQLiteHarmonyDatabase.cpp
    sqlc/SQLitePlugin.cpp
    CoreHarmony/CoreHarmony.cpp
    NetworkManager/NetworkManager.cpp
    Socket.cpp
    SSLSocket.cpp
    ConnPool.cpp
    FileCache.cpp
    MemPool.cpp
    Lock.cpp
    camera/CameraLauncher.cpp
    SplashScreen/SplashScreen.cpp
    inappbrowser/InAppBrowser.cpp
    file/FileUtils.cpp
    FileTransfer/FileTransfer.cpp
    Permissions/Permissions.cpp
    Permissions/CDVPermission.cpp
    ImagePicker/ImagePicker.cpp
    ImagePicker/MediaPicker.cpp
    Capture/Capture.cpp
    BarcodeScanner/BarcodeScanner.cpp
    BarcodeScanner/MLKitBarcodeScanner.cpp
    Bluetooth/BLECentralPlugin.cpp
    Bluetooth/BluetoothPlugin.cpp
    ble/BluetoothSerial.cpp
    DatePickerPlugin/DatePickerPlugin.cpp
    alipay/alipay.cpp
    Base64ToGallery/Base64ToGallery.cpp
    Base64ToGallery/SaveImageGallery.cpp
    HuaweiPush/HuaweiPush.cpp
    Notification/Notification.cpp
    Badge/Badge.cpp
    Whitelist/WhitelistPlugin.cpp
    Device/Device.cpp
    StatusBar/StatusBar.cpp
    HotCodePushPlugin/HotCodePushPlugin.cpp
    HotCodePushPlugin/FetchUpdateOptions.cpp
    BaiduGeolocation/translateWgs.cpp
    BaiduGeolocation/GeolocationPlugin.cpp
    BaiduGeolocation/Geolocation.cpp
    TsCordovaPlugin/TsCordovaPlugin.cpp
    minizip/ioapi.c
    minizip/unzip.c
    minizip/zip12.c
    minizip/Zip.cpp
    media/AudioHandler.cpp
    media/AudioPlayer.cpp
    vibrate/vibrate.cpp
    Globalization/Globalization.cpp
    BatteryListener/BatteryListener.cpp
    CDVOrientation/CDVOrientation.cpp
    NavigationBar/NavigationBar.cpp
    AppVersion/AppVersion.cpp
    AppVersion/RareloopAppVersion.cpp
    file/md5chksum.cpp
    ClearCache/CacheClear.cpp
    ClearCache/ClearData.cpp
    ClearCache/CordovaClearCache.cpp
    SpinnerDialog/SpinnerDialog.cpp
    NativeStorage/NativeStorage.cpp
    FullScreen/FullScreenPlugin.cpp
    Keyboard/CDVIonicKeyboard.cpp
    Keyboard/Keyboard.cpp
    AppMin/AppMinimize.cpp
    BackgroundMode/BackgroundMode.cpp
    BackgroundMode/BackgroundModeExt.cpp
    Broadcaster/CDVBroadcaster.cpp
    Toast/Toast.cpp
    Notification/LocalNotification.cpp
    Http/CordovaHttpPlugin.cpp
    IonicWebView/IonicWebView.cpp
)

target_link_libraries(cordova PUBLIC
    librawfile.z.so
    libace_napi.z.so
    libohweb.so
    libhilog_ndk.z.so
    libbundle_ndk.z.so
    libnative_rdb_ndk.z.so
    libnet_connection.so
    libohfileuri.so
    libohenvironment.so
    libohcamera.so
    libimage_ndk.z.so
    libimage_receiver_ndk.z.so
    libnative_image.so
    libpixelmap_ndk.z.so
    libimage_source_ndk.z.so
    libimage_packer_ndk.z.so
    libohfileuri.so
    libz.so
    libavplayer.so
    libnative_media_core.so
    libohvibrator.z.so
    libicu.so
    libohcommonevent.so
    libohbattery_info.so
    libohpreferences.so
    libhiappevent_ndk.z.so
    ${OPENSSL_LIB_PATH}/libssl.so.3
    ${OPENSSL_LIB_PATH}/libcrypto.so.3
)